#!/bin/bash

# ... update match.sqlite
echo "attach 'trace.sqlite' as trace;" > tmp-delay-match
awk '{if ($2=="node") {print "UPDATE match SET numHop="$5" WHERE dataobjectId=*"$1"* AND nodeName=(SELECT name from trace.devices where nodeId=*"$3"*);"}}' tmp-delay-net | sed "s/*/'/g" >> tmp-delay-match
sqlite3 -batch match.sqlite < tmp-delay-match